<template>
  <el-dialog v-loading="loading" :append-to-body="true" :close-on-click-modal="false" :visible.sync="visable" title="荣誉申请详情" width="860px" top="3vh" @close="closeDlg">
    <table class="billinfo-table" width="100%">
      <tr>
        <td colspan="2"><div class="bill-item"><label>申请标题</label><p>{{ entity.applyName }}</p></div></td>
      </tr>
      <tr>
        <td width="50%"><div class="bill-item"><label>申请人</label><p>{{ entity.applicantName }}</p></div></td>
        <td width="50%"><div class="bill-item"><label>申请时间</label><p>{{ entity.applyTime | parseTime("{y}-{m}-{d}") }}</p></div></td>
      </tr>
      <tr>
        <td><div class="bill-item"><label>荣誉名称</label><p>{{ entity.name }}</p></div></td>
        <td><div class="bill-item"><label>所属部门</label><p>{{ entity.deptName }}</p></div></td>
      </tr>
      <tr>
        <td><div class="bill-item"><label>获奖时间</label><p>{{ entity.gotTime | parseTime("{y}-{m}-{d}") }}</p></div></td>
        <td><div class="bill-item"><label>荣誉类型</label><p>{{ entity.typeName }}</p></div></td>
      </tr>
      <tr>
        <td colspan="2"><div class="bill-item"><label style="width:160px;">获得教师、学生、部门</label><p>{{ entity.winner }}</p></div></td>
      </tr>
      <tr>
        <td colspan="2"><div class="bill-item"><label style="width:160px;">获得人所属部门、班级</label><p>{{ entity.winDept }}</p></div></td>
      </tr>
      <tr>
        <td><div class="bill-item"><label>颁发部门</label><p>{{ entity.givingDept }}</p></div></td>
        <td><div class="bill-item"><label>荣誉级别</label><p>{{ entity.publishLevelName }}</p></div></td>
      </tr>
      <tr>
        <td colspan="2"><div class="bill-item"><label>描述说明</label><p>{{ entity.content }}</p></div></td>
      </tr>
      <tr>
        <td colspan="2">
          <div class="bill-item-1"><label>附件</label>
            <p>
              <a v-for="(po) in appendFileList" :key="po.url" :download="po.name" :href="po.url" style="margin-bottom:8px;display: block" target="_blank">{{ po.name }}</a>
            </p>
          </div>
        </td>
      </tr>
      <tr class="approve-tr">
        <td colspan="2"><div class="bill-item"><label>状态</label><p>{{ entity.statusName }}</p></div></td>
      </tr>
      <tr class="approve-tr">
        <td colspan="2"><div class="bill-item"><label>审批意见</label><p>{{ entity.approveComment }}</p></div></td>
      </tr>
      <tr>
        <td><div class="bill-item"><label>审批人</label><p>{{ entity.approveName }}</p></div></td>
        <td><div class="bill-item"><label>审批时间</label><p>{{ entity.approveTime | parseTime("{y}-{m}-{d}") }}</p></div></td>
      </tr>
    </table>
  </el-dialog>
</template>

<script>
import request from '@/utils/request'
export default {
  name: 'AwardShow',
  data() {
    return {
      loading: false,
      visable: false,
      entity: {
        id: null,
        gotTime: '',
        typeName: '',
        winDept: '',
        winner: '',
        givingDept: '',
        publishLevelName: '',
        content: '',
        appendFiles: null
      },
      appendFileList: []
    }
  },
  methods: {
    cancel() {
      this.closeDlg()
    },
    show(id) {
      request({ url: '/edu/award/' + id, method: 'get' }).then(data => {
        this.entity = data
        // appenfile
        if (this.entity.appendFiles) {
          this.appendFileList = JSON.parse(this.entity.appendFiles)
        }
        this.visable = true
      }).catch(err => {
        this.$message.error(err.message)
      })
    },
    closeDlg() {
      this.visable = false
    }
  }
}
</script>
